package cn.lili.modules.member.entity.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * 添加会员DTO
 *
 * @author Bulbasaur
 * @since 2020/12/14 16:31
 */
@Data
public class MemberAddDTO {

    @NotEmpty(message = "会员用户名必填")
    @Size(max = 30,message = "会员用户名最长30位")
    @ApiModelProperty(value = "会员用户名")
    private String username;

    @ApiModelProperty(value = "会员密码")
    private String password;

    @NotEmpty(message = "主账号(手机号码)不能为空")
    @ApiModelProperty(value = "手机号码", required = true)
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误")
    private String mobile;

    @NotEmpty(message = "公司名称必填")
    @ApiModelProperty(value = "公司名称")
    private String companyName;

    @NotEmpty(message = "级别必填")
    @ApiModelProperty(value = "级别")
    private int level;

    @NotEmpty(message = "店铺个数限制必填")
    @ApiModelProperty(value = "店铺个数限制")
    private int storeLimitNum;

    @NotEmpty(message = "合同生效时间必填")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "合同生效时间")
    private Date contractStart;

    @NotEmpty(message = "合同失效时间必填")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "合同失效时间")
    private Date contractEnd;
}
